setTimeout(function () {
  var a = "hello";
  setTimeout(function () {
    var b = "lagou";
    setTimeout(function () {
      var c = "I ❤️ U";
      console.log(a + b + c);
    }, 10);
  }, 10);
}, 10);

// 方式1
/* new Promise((resolve) => {
  const a = "hello";
  return a;
})
  .then((resA) => {
    const b = "lagou";
    return resA + b;
  })
  .then((resB) => {
    const c = "I ❤️ U";
    console.log(resB + c);
  }); */

// 方式2
/* async function showStr() {
  let a = await Promise.resolve("hello");
  let b = await Promise.resolve("lagou");
  let c = await Promise.resolve("I ❤️ U");

  return a + b + c;
}

showStr(); */

// 方式3
/* function promise(str) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve(str);
    }, 10);
  });
}

async function showStr() {
  const a = await promise("hello");
  const b = await promise("lagou");
  const c = await promise("I ❤️ U");

  return a + b + c;
}
console.log(showStr()); */

Promise.resolve("hello")
  .then((value) => value + "lagou")
  .then((value) => value + "I ❤️ U")
  .then((value) => console.log(value));
